﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="detail.aspx.vb" Inherits="bookmeetprototype.detail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="gridviewdetail">
    <%-- Single Record Gridview with Query String attachment --%>
        <asp:GridView ID="GridView1" 
            runat="server" AutoGenerateColumns="False" 
        DataSourceID="booklist" GridLines="None" AllowPaging="True" CssClass="dGrid" 
            PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" Width="640px">
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
    <Columns>
    
        <asp:ImageField DataImageUrlField="imgurl" NullImageUrl="~/img/no_image.jpg">
            <ControlStyle Height="200px" Width="130px" />
        </asp:ImageField>
        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
        <asp:BoundField DataField="Author" HeaderText="Author" 
            SortExpression="Author" />
        <asp:BoundField DataField="PublicationDate" dataformatstring="{0:MMMM d, yyyy}" htmlencode="false" HeaderText="Date of Publication" 
            SortExpression="PublicationDate" />
        <asp:BoundField DataField="Pages" HeaderText="Pages" SortExpression="Pages" />
        <asp:BoundField DataField="Publisher" HeaderText="Publisher" 
            SortExpression="Publisher" />
        <asp:BoundField DataField="AverageRating" HeaderText="Average Rating" 
            SortExpression="AverageRating" />
        <asp:BoundField DataField="Blurb" HeaderText="Description" 
            SortExpression="Blurb" />
    </Columns>

<PagerStyle CssClass="pgr"></PagerStyle>
    </asp:GridView>
    <asp:SqlDataSource ID="booklist" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BookMeetConnString %>" 
        ProviderName="<%$ ConnectionStrings:BookMeetConnString.ProviderName %>" 
        
            SelectCommand="SELECT [Title], [Author], [PublicationDate], [Pages], [Publisher], [AverageRating], [thumburl], [imgurl], [Blurb] FROM [booklist] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="ID" QueryStringField="ID" 
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
        <br />
        </div>
         <br />
         <%-- Don't know if this is necessary? --%>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BookMeetConnString %>" 
        ProviderName="<%$ ConnectionStrings:BookMeetConnString.ProviderName %>" 
        SelectCommand="SELECT [Title], [Author], [Description], [imgurl] FROM [booklist] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="ID" QueryStringField="ID" 
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <div style="overflow:auto;height:300px">
    <%-- Comments Box --%>
     <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataSourceID="CommentsDataSource" Height="167px" Width="325px">
        <Columns>
          <asp:TemplateField HeaderText="Comments">
            <ItemTemplate>
            <div style="background-color:Silver">
            <h1><%# Eval("TagLine")%></h1>
            <h2><%# Eval("BookCommenter")%></h2>
            <p><%# Eval("CommentBody")%></p>
            </div>
            </ItemTemplate>
            <AlternatingItemTemplate>
            <div style="background-color:White">
            <h1><%# Eval("TagLine")%></h1>
            <h2><%# Eval("BookCommenter")%></h2>
            <p><%# Eval("CommentBody")%></p>
            </div>
            
            
            </AlternatingItemTemplate>




            </asp:TemplateField>
        </Columns>
        
    </asp:GridView>

<asp:SqlDataSource ID="commentsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BookMeetConnString %>" 
        ProviderName="<%$ ConnectionStrings:BookMeetConnString.ProviderName %>" 
        SelectCommand="SELECT [BookCommenter], [TagLine], [CommentBody] FROM [comments] WHERE ([BookID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="BookID" QueryStringField="ID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
   
    <%-- End of Comments Box --%>
    </div>
    <%-- Add a comment --%>
    <br />
    <br />
    <strong>Add Your Comment
    <asp:LoginName ID="LoginName1" runat="server" />
    <br />
    &nbsp;<br />
    Title
    <br />
    <asp:TextBox ID="tb_Subject" runat="server" Width="319px"></asp:TextBox>
    <br />
    Your Comment
    <br />
    <asp:TextBox ID="tb_Message" runat="server" Height="146px" Width="337px" 
        TextMode="MultiLine"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" Width="148px" />
    </strong>
            <%-- End of add a comment --%>
<br />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="SidebarContent" runat="server">
   <h1>Add a tag for this book!</h1> (separate multiple tags with a comma)<br />
    <asp:TextBox ID="tb_NewTags" runat="server" Width="278px"></asp:TextBox>
    <h1>Current Tags:</h1>
    <asp:CheckBoxList ID="CheckBoxList1" runat="server" 
        DataSourceID="SqlDataSource2" DataTextField="Tag" DataValueField="ID" 
        RepeatDirection="Horizontal">
    </asp:CheckBoxList>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BookMeetConnString %>" 
        ProviderName="<%$ ConnectionStrings:BookMeetConnString.ProviderName %>" 
        SelectCommand="SELECT [ID], [Tag] FROM [tag]"></asp:SqlDataSource>

    <br />
    <asp:Button ID="Button2" runat="server" Text="Add Your Tag!" Width="119px" />

<br />
    <br /><table style="background-color:#FFFFFF" width="200" cellpadding="1" cellspacing="1">
	<tr>
		<td><asp:HyperLink   
            ID="returntolistdetail"   
            runat="server"  
            Text="Return to the list"  
            NavigateUrl="~/list.aspx"  
            > 
        </asp:HyperLink></td>
		<td><asp:HyperLink   
            ID="addabook"   
            runat="server"  
            Text="Add A Book!"  
            NavigateUrl="~/addbook.aspx"  
            >  
        </asp:HyperLink></td>
	</tr>
</table></asp:Content>